import QRequest from '@/service/index';
import type { EquipmentParams, EquipmentResponse, AddEquipmentData } from './model/type';

/**
 * @: 获取设备管理
 * @param {EquipmentParams} params
 * @return {*}
 */
export const doGetEquipmentList = (params: EquipmentParams) => {
    return QRequest.get<EquipmentResponse>(`/equipment/page`, { params });
};

/**
 * @: 删除设备管理
 * @param {number} params
 * @return {*}
 */
export const doDelEquipment = (data: number[]) => {
    return QRequest.delete(`/equipment/delete`, {
        data,
        headers: {
            hideLoading: 1
        }
    });
};

/**
 * @: 编辑设备管理
 * @param {AddEquipmentData} data
 * @return {*}
 */
export const doUpdateEquipment = (data: AddEquipmentData) => {
    return QRequest.put(`/equipment/update`, data, {
        headers: {
            hideLoading: 1
        }
    });
};

/**
 * @: 新增设备管理
 * @param {AddEquipmentData} data
 * @return {*}
 */
export const doAddEquipment = (data: AddEquipmentData[]) => {
    return QRequest.post(`/equipment/save`, data, {
        headers: {
            hideLoading: 1
        }
    });
};
